import React from 'react'
import { useNavigate } from 'react-router-dom'
export default function Test() {
  const navigate = useNavigate()
  return (
    <div>
      Test
      <button
        onClick={() => {
          setTimeout(() => {
            navigate('/about/1?name=zs&age=19', {
              replace: true, // 替换历史记录
              state: [1, 2, 3], //传递location.state数据
            })
          }, 2000)
        }}
      >
        点击过了2s钟之后,跳转到about页面
      </button>
    </div>
  )
}
